<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>大包流转记录</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	统计分析
	<span class="c-gray en">&gt;</span>
	大包流转记录
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container" id="app">
	<form id="queryForm">
		<div class="text-c"> 
			<!-- 字典名称:
			<input type="text" class="input-text" id="" name="" style="width:150px"> -->
			<span> 日期范围：
			<input name="startTime" type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'logmax\')||\'%y-%M-%d\'}' })" id="logmin" class="input-text Wdate" style="width:120px;">
			-
			<input name="startTime" type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'logmin\')}',maxDate:'%y-%M-%d' })" id="logmax" class="input-text Wdate" style="width:120px;">
			</span>
			分公司:
			<span class="select-box inline">
			<select class="select" id="comId" name="comId" onchange="queryOffice(this.value)">
				<option value="">请选择分公司</option>
			</select>
			</span>
			票务室:
			<span class="select-box inline">
			<select class="select" id="toId" name="toId">
				<option value="">请选择票务室</option>
			</select>
			</span>
			节点:
			<span class="select-box inline">
			<select class="select" id="step" name="step">
				<option value="0">请选择节点</option>
				<option value="1">满胆封包</option>
				<option value="2">空胆封包</option>
				<option value="3">大包（空）接收 票务室</option>
				
				<!-- <option value="1">空胆入柜</option>
				<option value="2">空胆领取</option>
				<option value="3">在途运营</option>
				<option value="4">实胆摘胆</option>
				<option value="5">实胆入柜</option>
				<option value="6">实胆运输</option>
				<option value="7">实胆清点</option>
				<option value="8">空胆运输</option> -->
			</select>
			</span>
			
			<!-- 节点:
			<span class="select-box inline">
			<select class="select" id="status" name="status">
				<option value="">请大包状态</option>
				<option value="0">未接收</option>
				<option value="1">已接收</option>
				<option value="2">已被修改的历史数据</option>
			</select>
			</span> -->
			<input type="text" name="cashboxId" id="cashboxId" placeholder="钱胆ID（非必填）" style="width:250px" class="input-text">
			<button class="btn btn-success" type="button" v-on:click="query()"><i class="Hui-iconfont">&#xe665;</i>查询</button>
		</div>
	</form>	
	
	<div class="mt-10">
		<table id="list" class="table table-border table-bordered table-bg table-hover table-sort" style="width: 99%;">
		</table>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="DataTables/datatables.js"></script>
<script type="text/javascript" src="js/jquery.base64.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="js/vue.js" charset="utf-8"></script>
<script type="text/javascript">

	function queryOffice(companyid){
		$.ajax({
			url: ipAddress + 'base/office/getList',
			// url: 'http://localhost:8000/office/getList',
			data: {
				"company.companyid": companyid,
				order: "id"
			},
			beforeSend: function (request) {
				request.setRequestHeader("Authorization", "Bearer " + getToken());
			},
			method:'GET',
			success:function (data,status,request) {
				console.log(data);
				$("#toId").empty();
				$("#toId").append("<option value>请选择票务室</option>");
				for(var i = 0; i < data.length; i ++){
					$("#toId").append("<option value='" + data[i].id + "'>" + data[i].officename + "</option>");
				}
			},
			error:function (request, msg, obj) {
				var respTxtObj = JSON.parse(request.responseText);
				console.log(respTxtObj);
				console.log(respTxtObj.error);
				console.log(respTxtObj.error_description);
			}
		});
	}

	$.ajax({
		url: ipAddress + 'base/company/getList',
		// url: 'http://localhost:8000/company/getList',
		data: {
			order: "ordercode"
		},
		beforeSend: function (request) {
			request.setRequestHeader("Authorization", "Bearer " + getToken());
		},
		method:'GET',
		success:function (data,status,request) {
			console.log(data);
			$("#comId").append("<option value>请选择分公司</option>");
			for(var i = 0; i < data.length; i ++){
				$("#comId").append("<option value='" + data[i].companyid + "'>" + data[i].companyname + "</option>");
			}
		},
		error:function (request, msg, obj) {
			var respTxtObj = JSON.parse(request.responseText);
			console.log(respTxtObj);
			console.log(respTxtObj.error);
			console.log(respTxtObj.error_description);
		}
	});

	var vm = new Vue({
		el : "#app",
		data : {
			msg : ""
		},
		//在实例初始化之后，数据观测 (data observer) 和 event/watcher 事件配置之前被调用。
		beforeCreate:function(){
			console.log('beforeCreate');
		},
		/* 在实例创建完成后被立即调用。
		在这一步，实例已完成以下的配置：数据观测 (data observer)，属性和方法的运算，watch/event 事件回调。
		然而，挂载阶段还没开始，$el 属性目前不可见。 */
		created	:function(){
			console.log('created');
		},
		//在挂载开始之前被调用：相关的渲染函数首次被调用
		beforeMount : function(){
			console.log('beforeMount');
	
		},
		//el 被新创建的 vm.$el 替换, 挂在成功	
		mounted : function(){
			console.log('mounted');
		
		},
		//数据更新时调用
		beforeUpdate : function(){
			console.log('beforeUpdate');
				
		},
		//组件 DOM 已经更新, 组件更新完毕 
		updated : function(){
			console.log('updated');
				
		},
		methods: {
			query: function(){
				table.draw();
			}
		}
	});

	var table = $('#list').DataTable({
		language: {
			url: 'static/h-ui.admin/js/de_DE.txt'
		},
		//stateSave: true,
		"lengthMenu":[10, 50, 100],
		"pageLength": 100,
		searching: false,
		processing: true,
		serverSide: true,
		order: [[1, 'asc']],
		ajax: {
			url: report_service + '/getPageBigpocketCashbox',
			//url: 'http://192.168.4.235:8800/report/getPageBigpocketCashbox',
			type: 'GET',
			data: function ( data ) {
				var param = {};
				var userInfo = getUserInfo();
				var order = data.columns[data.order[0].column].data + " " + data.order[0].dir;
				param.start = data.start;
				param.length = data.length;
				param.draw = data.draw;
				//param.like = '%line.lineid%';
				param.order = order;
				var formData = $("#queryForm").serializeArray();//把form里面的数据序列化成数组
				formData.forEach(function (e) {
					if(e.value != ''){
						param[e.name] = e.value;
					}
				});
				return param;
			}
		},
		columns: [
			//{title: '所属分公司', name: 'companyId', data: 'companyId', defaultContent: '无'},
			{title: '所属分公司', name: 'companyName', data: 'companyName', defaultContent: '无'},
			//{title: '所属票务室', name: 'officeId', data: 'officeId', defaultContent: '无'},
			{title: '所属票务室', name: 'officeName', data: 'officeName', defaultContent: '无'},
			{title: '大包二维码', name: 'bigpocket', data: 'bigpocket', defaultContent: '无'},
			{title: '封条号码', name: 'pockettag', data: 'pockettag', defaultContent: '无'},
			{title: '批次号', name: 'batchno', data: 'batchno', defaultContent: '无'},
			{title: '钱胆ID', name: 'cashboxId', data: 'cashboxId', defaultContent: '无'},
			// {title: '是否被物流接收', name: 'status', data: 'status', defaultContent: '',
			// 		render: function(data, type, full, meta) {
			// 			var status = full.status;
			// 			if(status!=null&&status!=""){
			// 				if(status.indexOf("0") != -1){
			// 					return "<td>未接收</td>"
			// 				}else if(status.indexOf("1") != -1){
			// 					return "<td>已接收</td>"
			// 				}else if(status.indexOf("2") != -1){
			// 					return "<td>已被修改的历史数据</td>"
			// 				}else{
			// 					return "<td></td>"
			// 				}
			// 			}else{
			// 				return "<td></td>"
			// 			}
			// 		}
			// },
			{title: '节点', name: 'step', data: 'step', defaultContent: '',
				render: function(data, type, full, meta) {
					var step = full.step;
					if(step!=null&&step!=""){
						if(step.indexOf("1") != -1){
							return "<td>满胆封包</td>"
						}else if(step.indexOf("2") != -1){
							return "<td>空胆封包</td>"
						}else if(step.indexOf("3") != -1){
							return "<td>大包（空）接收 票务室</td>"
						}else{
							return "<td></td>"
						}
					}else{
						return "<td></td>"
					}
					
					
				}
			},
			{title: '操作时间', name: 'userTime', data: 'userTime', defaultContent: ''},
			//{title: '操作人', name: 'userId', data: 'userId', defaultContent: ''},
			{title: '操作人', name: 'userName', data: 'userName', defaultContent: ''}
			// {title: '流水号', name: 'circleTimes', data: 'circleTimes', defaultContent: '',
			// 	render: function(data, type, full, meta) {
			// 		var name="";
			// 		if(full.cashboxId.indexOf("C") != -1){
			// 			name = "钱胆("+full.cashboxId+")流转环节轨迹";
			// 			return  '<a style="text-decoration:underline;" onclick="report_cashbox_view(\''+name+'\',\'report-cashbox-view.html?id='+full.cashboxId+'&step='+full.circleTimes+'&stepname='+full.step+'\',\'\',\'1000\',\'600\')" href="javascript:;">'+data+'</a>';
			// 		}else{
			// 			name = "款包("+full.cashboxId+")流转环节轨迹";
			// 			return  '<a style="text-decoration:underline;" onclick="report_cashbox_view(\''+name+'\',\'report-cashbox-view-R.html?id='+full.cashboxId+'&step='+full.circleTimes+'&stepname='+full.step+'\',\'\',\'1000\',\'600\')" href="javascript:;">'+data+'</a>';
			// 		}
			// 	}
			// }
		],
		columnDefs: [
			{"orderable": false, "targets": [0]}
		]
	});
	
function report_cashbox_view(title, url, id, w, h) {
	layer_show_cr(title, url, w, h);
} 
function layer_show_cr(title,url,w,h){
	if (title == null || title == '') {
		title=false;
	};
	if (w == null || w == '') {
		w=800;
	};
	if (h == null || h == '') {
		h=($(window).height() - 50);
	};
	layer.open({
		type: 2,
		area: [w+'px', h +'px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: title,
		content: url,
		end:function(){
			//location.reload();
		}
	});
}

</script>
</body>
</html>